package com.example.qimozuoye;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

public class MainActivity2 extends AppCompatActivity {

    private Spinner mSpinner;

    private ArrayAdapter mAdapter ;

    private String [] mStringArray;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        init();
    }



    private void init(){
        mSpinner=(Spinner) findViewById(R.id.spinner);

        mStringArray=getResources().getStringArray(R.array.qqlanguages);

//使用自定义的ArrayAdapter

        mAdapter = new TestArrayAdapter(MainActivity2.this,mStringArray);

//设置下拉列表风格(这句不些也行)

//mAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

        mSpinner.setAdapter(mAdapter);

//监听Item选中事件
//        ItemSelectedListenerImpl
//        mSpinner.setOnItemSelectedListener(new ());
//
    }

}